<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>小马时贷</title>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link href="../../libs/mui.min.css" rel="stylesheet"/>
    <link href="../../css/main.css" rel="stylesheet"/>
    <link href="../../css/select-work.css" rel="stylesheet"/>
</head>

<body>
<div class="head">
    <img class="mui-action-back" src="../../images/all-left.png" alt="">
    <p>选择评估</p>
</div>
<div class="content">
    <p class="decro"> 请选择您的评估来进行贷款申请：</p>

    <!--<div class="select-assess-item">
        <p class=""><span class="roll"></span><span class="type-title">人寿保单评估</span></p>
        <div>
            <span class="assess-left">申请人：张三</span>
            <span class="assess-right">评估记录：通过</span>
        </div>
        <div>
            <span class="assess-left">可申请金额：10，000元</span>
        </div>
    </div>-->

    <div class="button">
        <button id="next">下一步</button>
    </div>
</div>
<script src="../../libs/mui.min.js"></script>
<script src="../../js/jquery-3.1.1.min.js"></script>
<script src="../../js/url.js"></script>
<script type="text/javascript">
    //选择样式
    $('.content').on('tap', '.select-assess-item', function () {
        if ($(this).find('.roll').classList == 'active') {
            $(this).find('.roll').removeClass('active');
        } else {
            $(this).find('.roll').addClass('active');
            $(this).siblings().find('.roll').removeClass('active');
        }
    });
    //获取当前业务类型的评估列表
    $.ajax({
        url: ur + 'rest/loanController/getEvaluate',
        type: "get",
        dataType: 'json',
        headers: {
            "X-Token": localStorage.token
        },
        data: {
            loanCode: localStorage.loanCode,
            succ: true
        },
        success: function (data) {
            if (data.meta.code === 'S002') {
                for (var i = 0; i < data.data.list.length; i++) {
                    var assessItem = '<div class="select-assess-item"><p class=""><span class="roll" key="' +
                        data.data.list[i].id + '"></span><span class="type-title">' +
                        data.data.list[i].loan + '</span></p><div><span class="assess-left">申请人：' +
                        data.data.list[i].user + '</span><span class="assess-right">评估记录：通过</span></div><div><span class="assess-left">可申请金额：' +
                        data.data.list[i].price + '万元</span></div></div>';
                    $('.button').before(assessItem);
                }
            } else {
                mui.toast(data.meta.message);
            }
        }
    });

    $('.button').on('tap', function () {
        var len = $('.active').length;
        if (len === 1) {
            localStorage.evaluateId = $('.active').attr('key');
            //					localStorage.loanCode=$('.active').attr('key');
            if (localStorage.fastPassAskfor == 'true') { //快速贷跳过选择代理商
                switch (localStorage.loanCode) {
                    case 'aj':
                        href('askfor-aj.html', 'askfor-aj');
                        break;
                    case '2y':
                        href('askfor-2y.html', 'askfor-2y');
                    case 'fcdy':
                        href('askfor-fcdy.html', 'askfor-fcdy');
                        break;
                    case 'qcdy':
                        href('askfor-qcdy.html', 'askfor-qcdy');
                        break;
                    default:
                        href('askfor2.html', 'askfor2');
                }
            } else {
                switch (localStorage.loanCode) {
                    case 'aj':
                        href('askfor-aj.html', 'askfor-aj');
                        break;
                    default:
                        href('askfor.html', 'askfor');
                }
            }

        } else {
            mui.toast('请选择评估！');
        }
    });
</script>
</body>

</html>